<template>
				<div class="mui-numbox" data-numbox-min='1' :data-numbox-max='counts'>
					<button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
					<input id="test" class="mui-input-numbox" type="number" value="1"  
                    @change="countChanged" ref="numbers" />
					<button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
				</div>
</template>
<script>
import mui from '../../js/mui.min.js'
export default {
    data() {
        return {
           
        }
    },
    mounted() {
        mui('.mui-numbox').numbox()
       
    },
    methods: {
        countChanged() {
            // this.$emit('getcount',parseInt(this.$refs.numbers.value))
            // console.log(this.$refs.numbers.value);
            this.$emit("getcount", parseInt(this.$refs.numbers.value));
        }
    },
    props: ['counts'],
    watch:  {
        'counts': function(newVal,oldVal) {
            // 设置数量的最大新值
            mui('.mui-numbox').setOption('counts',newVal)
        }
    }
}
</script>
<style lang="scss" scoped>
    
</style>
